﻿using System.Collections.Generic;
using UnityEditor;
using System.Text.RegularExpressions;
using Framework;

namespace FrameworkEditor
{
    public class IAbSetting
    {
        public static Regex IgnoreExtRegex = new Regex("(.meta|.git)$");
        private string _dirPath;
        internal string DirPath
        {
            get { return _dirPath; }
        }
        private Regex _fileFilter;

        internal IAbSetting(string path, string filterRegex)
        {
            _dirPath = FileHelper.GetUnityPath(path);
            if (!string.IsNullOrEmpty(filterRegex))
            {
                _fileFilter = new Regex(filterRegex);
            }
        }

        internal bool IsNeedBuild(string filePath)
        {
            filePath = FileHelper.GetUnityPath(filePath);
            if (IgnoreExtRegex.IsMatch(filePath))
            {
                return false;
            }
            if (null != _fileFilter && !_fileFilter.IsMatch(filePath))
            {
                return false;
            }
            return true;
        }

        internal virtual List<AssetBundleBuild> GetAllBuilders()
        {
            return null;
        }
    }
}